package com.woniuxy.creditsystem.systemmag.controller;

import com.github.pagehelper.PageInfo;
import com.woniuxy.creditsystem.common.bean.DataSourceInfo;
import com.woniuxy.creditsystem.common.bean.ResultMsg;
import com.woniuxy.creditsystem.common.bean.RoleInfo;
import com.woniuxy.creditsystem.common.bean.TableDataBean;
import com.woniuxy.creditsystem.common.util.TraceUtil;
import com.woniuxy.creditsystem.systemmag.service.IDataSourceService;
import com.woniuxy.creditsystem.systemmag.service.IRoleMenuService;
import com.woniuxy.creditsystem.systemmag.service.IRoleService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

/**
 * 数据源 表的查询（）data_source_info
 * @author hejie
 */
@RequestMapping("/dataSource")
@RestController
public class DataSourceController {

    @Resource
    private IDataSourceService dataSourceServiceImpl;

    /**
     * 查询所有的 数据源（用来做selection的option）
     * @author hejie
     * @return
     */
    @RequestMapping(value="/all",produces = {"application/json;charset=utf-8"})
    public List<DataSourceInfo> findAll(){
        System.out.println("\n in role-findAll"+ TraceUtil.positionTrace());
        List<DataSourceInfo> dataSourceInfoList=dataSourceServiceImpl.findAll();
        for (DataSourceInfo r:dataSourceInfoList ) {
            System.out.println(r);
        }
        return dataSourceInfoList;
    }
}
